// 源插件
import React, { PureComponent } from 'react';
import { DateDiff, DateStamp, FormatnumberZero, Mover, NumberDivide } from '@/function.js';
// 视图插件
import { Button, Card, Form, Modal, notification } from 'antd';
// 外部组件
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import StandardTablePro from '@/components/UpgradeStandardTable/StandardTablePro';
import { connect } from 'dva';
import StockModal from './StockModal.js';
// css OR less预编译器

// 图片

/**
 *  Describe:数据连接
 */

@connect(({ fourfunds, loading }) => ({
  fourfunds,
  loading: loading.models.fourfundsRule,
}))
@Form.create()
class OptionModal extends PureComponent {
  componentWillMount() {}

  /**
   *  Describe:当前状态
   */

  state = {
    listLoading: false, // 加载状态
  };

  okHandle() {
    this.props.closeVisbile();
  }

  cancelHandle() {
    this.props.closeVisbile();
  }

  handleSave(row, values) {
    const that = this;
    const { dispatch } = that.props;
    dispatch({
      type: 'fourfunds/OptionTradeInfoUpdate',
      payload: { ...row, ...values },
      callback: res => {
        that.props.dataSourceModalChange();
      },
    });
  }

  render() {
    const { visible, dataSource } = this.props;
    return (
      <Modal
        destroyOnClose
        title="同步期权今日操作信息"
        visible={visible}
        width={window.innerWidth * 0.9}
        centered
        onOk={this.okHandle.bind(this)}
        onCancel={this.cancelHandle.bind(this)}
      >
        <StandardTablePro dataSource={dataSource} handleSave={this.handleSave.bind(this)} />
      </Modal>
    );
  }

  componentDidMount() {}

  componentWillUnmount() {}
}

export default OptionModal;
